/**
 * Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springblade.modules.system.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.system.entity.Drugs;
import org.springblade.modules.system.entity.DrugsType;
import org.springblade.modules.system.mapper.DrugsMapper;
import org.springblade.modules.system.mapper.DrugsTypeMapper;
import org.springblade.modules.system.service.IDrugsService;
import org.springblade.modules.system.service.IDrugsTypeService;
import org.springblade.utils.PageBounds;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 服务实现类
 *
 * @author Chill
 */
@Service
public class DrugsTypeServiceImpl extends ServiceImpl<DrugsTypeMapper, DrugsType> implements IDrugsTypeService {


	@Override
	public int addDrugsType(DrugsType drugsType) {
		return baseMapper.addDrugsType(drugsType);
	}

	@Override
	public int deleteDrugsType(Integer id) {
		return baseMapper.deleteDrugsType(id);
	}

	@Override
	public int updateDrugsType(DrugsType drugsType) {
		return baseMapper.updateDrugsType(drugsType);
	}

	@Override
	public PageBounds<DrugsType> showAllDrugsType(DrugsType drugsType, int currentPage, int pageSize) {
		final int size=baseMapper.getAllDrugsTypeCount(drugsType);
		PageBounds<DrugsType> pageBounds=new PageBounds<>(currentPage,size,pageSize);
		List<DrugsType> list=baseMapper.showAllDrugsType(drugsType,pageBounds.getOffset(),pageBounds.getPageSize());
		pageBounds.setPageList(list);
		return pageBounds;
	}


	@Override
	public DrugsType findByDrugsTypeId(Integer id) {
		return baseMapper.findByDrugsTypeId(id);
	}

	@Override
	public int deleteMoreDrugsPtype(List<Integer> ids) {
		return baseMapper.deleteMoreDrugsPtype(ids);
	}

	@Override
	public List<DrugsType> getAllDrugsType(DrugsType drugsType) {
		return baseMapper.getAllDrugsType(drugsType);
	}

	@Override
	public int delDrugsType(List<Integer> typeid) {
		return baseMapper.delDrugsType(typeid);
	}
}
